Emmanuele Bassi [Fri, 17 Jul 2020 11:49:59 +0000 (12:49 +0100)]
a11y: Consolidate the attributes container
While we have split the various attributes for convenience, there's no
reason why we should have specialised data types for the attributes
container object.
Emmanuele Bassi [Fri, 17 Jul 2020 11:00:31 +0000 (12:00 +0100)]
a11y: Add relations API
Since we split relation attributes from the generic properties, we need
to add API for setting and retrieving their values.
Emmanuele Bassi [Thu, 16 Jul 2020 17:08:22 +0000 (18:08 +0100)]
a11y: Simplify GtkAccessibleValue
Reduce the amount of subclassing, by handling collection of fundamental
types directly from the generic code paths. We now handle boolean,
tristate, integer, number, string, and relation values in the generic
code path; if an attribute supports the "undefined" value, we return the
undefined value singleton.
Emmanuele Bassi [Wed, 15 Jul 2020 18:08:37 +0000 (19:08 +0100)]
a11y: Resync with the ARIA spec
Drop roles and properties that were deprecated in WAI-ARIA 1.1, and add
new roles and properties defined in WAI-ARIA 1.2 and later.
We also split the relationship properties into their own enumeration, so
we can keep the GtkAccessibleProperty type more compact.
Emmanuele Bassi [Wed, 15 Jul 2020 12:20:38 +0000 (13:20 +0100)]
Remove GTK_ACCESSIBLE_STATE_NONE
It's pointless, we can use an explicit value of `-1` everywhere.
Additionally, it complicates all code that uses the state enumeration as
an array index, since now we need to guard against a negative offset.
Emmanuele Bassi [Mon, 13 Jul 2020 16:47:36 +0000 (17:47 +0100)]
a11y: Add binding-friendly accessible property setter
Matching the one for the accessible state.
Emmanuele Bassi [Mon, 13 Jul 2020 16:43:06 +0000 (17:43 +0100)]
a11y: Collect reference value
Some properties that take a reference to an accessible haven't been
updated to collect the correct type.
Emmanuele Bassi [Mon, 13 Jul 2020 16:04:38 +0000 (17:04 +0100)]
a11y: Update the accessible label for GtkButton
Emmanuele Bassi [Mon, 13 Jul 2020 15:26:24 +0000 (16:26 +0100)]
a11y: Update GtkSeparator
Add an accessible role, and update the orientation state.
Emmanuele Bassi [Mon, 13 Jul 2020 15:22:44 +0000 (16:22 +0100)]
a11y: Set the role for GtkScale
Emmanuele Bassi [Mon, 13 Jul 2020 15:22:22 +0000 (16:22 +0100)]
a11y: Update the accessible state for GtkRange
Emmanuele Bassi [Mon, 13 Jul 2020 15:10:36 +0000 (16:10 +0100)]
a11y: Update the "pressed" state on toggle buttons
Emmanuele Bassi [Mon, 13 Jul 2020 15:03:27 +0000 (16:03 +0100)]
a11y: Add roles to various widgets
Emmanuele Bassi [Mon, 13 Jul 2020 14:51:39 +0000 (15:51 +0100)]
Add accessible properties to GtkAccessible
We propagate the accessible state and properties to each ATContext in
the same virtual function, since they are functionally similar.
Emmanuele Bassi [Sun, 12 Jul 2020 19:07:57 +0000 (20:07 +0100)]
Add GtkAccessiblePropertySet
Like GtkAccessibleStateSet, the PropertySet is a set for accessible
properties.
Emmanuele Bassi [Mon, 13 Jul 2020 14:22:24 +0000 (15:22 +0100)]
Plumb all the GtkAccessibleProperty values into GtkAccessibleValue
Similarly to how we deal with GtkAccessibleState.
Emmanuele Bassi [Mon, 13 Jul 2020 14:20:19 +0000 (15:20 +0100)]
Allow setting the accessible role at construction
Some widgets have different accessible roles depending on some
parameter, so we cannot set the role at class init time. For those
widgets, we add an "accessible-role" property to GtkAccessible, and we
allow setting it (only) at construction time.
Emmanuele Bassi [Wed, 8 Jul 2020 13:42:32 +0000 (14:42 +0100)]
Start documenting the Accessibility API
Add the introductory text from #2833, and the various types to the API
reference.
Emmanuele Bassi [Tue, 7 Jul 2020 16:51:01 +0000 (17:51 +0100)]
Update the accessible state on widget visibility changes
The GTK_ACCESSIBLE_STATE_HIDDEN has the opposite meaning of the
GtkWidget:visible property.
Emmanuele Bassi [Wed, 8 Jul 2020 15:58:11 +0000 (16:58 +0100)]
Have GtkWidget implement GtkAccessible
Each widget type has an accessible role associated to its class, as
roles cannot change during the life time of a widget instance.
Each widget is also responsible for creating an ATContext, to proxy
state changes to the underlying accessibility infrastructure.
Emmanuele Bassi [Wed, 8 Jul 2020 15:56:31 +0000 (16:56 +0100)]
Plug GtkATContext into GtkAccessible
An Accessible implementation must create an ATContext object. UI
elements are supposed to interact with the GtkAccessible API, but we
expose GtkATContext to allow patterns like delegation.
Emmanuele Bassi [Wed, 8 Jul 2020 15:51:57 +0000 (16:51 +0100)]
Add GtkATContext
The ATContext type is meant to be used as the base class for
implementations of the assistive technology API—the actual mechanism
needed to communicate to components like the screen reader, or any other
AT.
Every time the widget state changes, the ATContext is meant to broadcast
the state change; and every time the AT queries the state of a UI
element, the ATContext is meant to provide that information.
We also have a "test" ATContext implementation, which is meant to be
used to write tests to verify that changes are propagated without
requiring a whole desktop session.
Emmanuele Bassi [Wed, 8 Jul 2020 15:45:57 +0000 (16:45 +0100)]
Add GtkAccessibleStateSet
Since states can be set or unset, we need a container type that has all
the possible states, and a bitmask that tells us which ones are set.
Emmanuele Bassi [Wed, 8 Jul 2020 15:34:32 +0000 (16:34 +0100)]
Add GtkAccessibleValue
All accessible properties and states may have one of the following
types:
- true/false
- true/false/undefined
- true/false/mixed/undefined
- reference (to another UI element)
- reference list
- integer
- number (real numerical value)
- string
- token (one of a limited set of allowed values)
- token list
See: https://www.w3.org/WAI/PF/aria/states_and_properties#propcharacteristic_value
The GtkAccessibleValue is a simple reference counted type that can be
"subclassed" to implement each value type.
This initial commit adds GtkAccessibleValue and the basic subclasses for
plain boolean, tristate (true/false/undefined), and token types,
including statically allocated values that can be shared instead of
allocated.
Emmanuele Bassi [Tue, 16 Jun 2020 16:40:14 +0000 (17:40 +0100)]
Introduce GtkAccessible
GtkAccessible is an interface for accessible UI elements.
Currently, it doesn't do much except exist as a type; in the future, it
will be the entry point for all accessible state in GTK.
Emmanuele Bassi [Tue, 16 Jun 2020 16:04:05 +0000 (17:04 +0100)]
a11y: Add the supported accessibility roles
The list of roles is taken from the WAI-ARIA 1.2 specification:
https://w3c.github.io/aria/
Some of these roles do not make entirely sense from a GTK application
perspective, but we can remove them before finalizing the API.
Emmanuele Bassi [Tue, 16 Jun 2020 15:41:59 +0000 (16:41 +0100)]
Remove ATK
To build a better world sometimes means having to tear the old one down.
-- Alexander Pierce, "Captain America: The Winter Soldier"
ATK served us well for nearly 20 years, but the world has changed, and
GTK has changed with it. Now ATK is mostly a hindrance towards improving
the accessibility stack:
- it maps to a very specific implementation, AT-SPI, which is Linux and
Unix specific
- it requires implementing the same functionality in three different
layers of the stack: AT-SPI, ATK, and GTK
- only GTK uses it; every other Linux and Unix toolkit and application
talks to AT-SPI directly, including assistive technologies
Sadly, we cannot incrementally port GTK to a new accessibility stack;
since ATK insulates us entirely from the underlying implementation, we
cannot replace it piecemeal. Instead, we're going to remove everything
and then incrementally build on a clean slate:
- add an "accessible" interface, implemented by GTK objects directly,
which describe the accessible role and state changes for every UI
element
- add an "assistive technology context" to proxy a native accessibility
API, and assign it to every widget
- implement the AT context depending on the platform
For more information, see: https://gitlab.gnome.org/GNOME/gtk/-/issues/2833
Benjamin Otte [Sun, 26 Jul 2020 19:24:25 +0000 (19:24 +0000)]
Merge branch 'wip/otte/boolfilter' into 'master'
Add GtkBoolFilter
See merge request GNOME/gtk!2288
Jordi Mas [Sun, 26 Jul 2020 19:13:16 +0000 (21:13 +0200)]
Update Catalan translation
Benjamin Otte [Sun, 26 Jul 2020 15:55:54 +0000 (17:55 +0200)]
Add GtkBoolFilter
Takes a boolean GtkExpression (like a boolean object property) to run a
filter with.
Matthias Clasen [Sun, 26 Jul 2020 12:00:49 +0000 (12:00 +0000)]
Merge branch 'matthiasc/for-master' into 'master'
overlaylayout: Document minimally
See merge request GNOME/gtk!2285
Matthias Clasen [Sat, 25 Jul 2020 23:02:33 +0000 (19:02 -0400)]
overlaylayout: Document minimally
This layout manager is not reusable, but we
still need to make its layout properties show
up in the docs.
Matthias Clasen [Sat, 25 Jul 2020 17:30:11 +0000 (17:30 +0000)]
Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master
See merge request GNOME/gtk!2284
Matthias Clasen [Sat, 25 Jul 2020 02:57:34 +0000 (22:57 -0400)]
gtk: Improve struct packing in places
Plug some holes in our structs by rearranging
a few fields. This is was done looking at
pahole output.
Matthias Clasen [Sat, 25 Jul 2020 02:57:00 +0000 (22:57 -0400)]
gdk: Improve struct packing in places
Plug some holes in our structs by rearranging
a few fields. This is was done looking at
pahole output.
Matthias Clasen [Sat, 25 Jul 2020 04:31:08 +0000 (00:31 -0400)]
colorswatch: Remove unused radius fields
The radius fields are never used.
Matthias Clasen [Sat, 25 Jul 2020 04:29:42 +0000 (00:29 -0400)]
hsla: Just store floats
We are using floats for rgb, and we don't need more precision
for hsl colors either. We use hsl for computing color expressions
like shade(), lighter() and darker(), which are not precisely
specified anyway.
This commit updates the one test where the output changes a
tiny bit due to this.
Matthias Clasen [Sat, 25 Jul 2020 11:40:24 +0000 (07:40 -0400)]
headerbar: Drop the Private struct
Matthias Clasen [Sat, 25 Jul 2020 02:56:24 +0000 (22:56 -0400)]
colorplane: Drop the Private struct and padding
Matthias Clasen [Sat, 25 Jul 2020 00:05:28 +0000 (00:05 +0000)]
Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master
See merge request GNOME/gtk!2283
Matthias Clasen [Fri, 24 Jul 2020 23:54:01 +0000 (23:54 +0000)]
Merge branch 'wip/otte/types' into 'master'
Get rid of unneeded glib types
See merge request GNOME/gtk!2282
Matthias Clasen [Fri, 24 Jul 2020 23:28:21 +0000 (19:28 -0400)]
Add another sortlistmodel test
This tests the crash fix in
f7b73b2e010960975.
Matthias Clasen [Fri, 24 Jul 2020 22:32:01 +0000 (18:32 -0400)]
testsuite: Add an incremental sort test
Add a test that makes changes to a model while it
is incrementally sorted.
Matthias Clasen [Fri, 24 Jul 2020 23:22:12 +0000 (19:22 -0400)]
timsort: Avoid a crash
We need to clear the pointer after freeing the data,
since the sortlistmodel keeps its timsort structure
around and reuses it.
Benjamin Otte [Fri, 24 Jul 2020 20:32:16 +0000 (22:32 +0200)]
Replace "gdouble" with "double"
Benjamin Otte [Fri, 24 Jul 2020 20:25:56 +0000 (22:25 +0200)]
Replace "gfloat" with "float"
Benjamin Otte [Fri, 24 Jul 2020 18:40:36 +0000 (20:40 +0200)]
Replace "gchar" with "char"
Benjamin Otte [Fri, 24 Jul 2020 13:54:49 +0000 (15:54 +0200)]
Replace "gint" with "int"
Matthias Clasen [Fri, 24 Jul 2020 19:37:49 +0000 (15:37 -0400)]
testsuite: Use better names for sortlistmodel tests
Name the tests for what they do.
Matthias Clasen [Fri, 24 Jul 2020 19:22:14 +0000 (15:22 -0400)]
testsuite: Reenable tests for incremental sort
This was unintentionally disabled.
Matthias Clasen [Fri, 24 Jul 2020 18:17:30 +0000 (18:17 +0000)]
Merge branch 'remove-align-widget' into 'master'
menubutton: Remove align-widget property
See merge request GNOME/gtk!2280
Matthias Clasen [Fri, 24 Jul 2020 14:40:55 +0000 (10:40 -0400)]
sortlistmodel: Fix a crash
Matthias Clasen [Fri, 24 Jul 2020 13:07:45 +0000 (09:07 -0400)]
dropdown: Fix popup sizing
Setting a width request is not quite enough, since
gtk_widget_set_size_request() only queues a resize
when the widget is visible. Explicitly force one
here. Without this, the popup sometimes shows up
too small.
Florian Müllner [Fri, 24 Jul 2020 11:39:38 +0000 (13:39 +0200)]
menubutton: Remove align-widget property
The property has been unused since commit
8701e34f749. That was four
years ago, so it's safe to say that nobody has been missing it terribly.
Timm Bäder [Fri, 24 Jul 2020 09:28:21 +0000 (09:28 +0000)]
Merge branch 'fix-gdk-array-msvc' into 'master'
gdk/gdkarrayimpl.c: Fix build on Visual Studio
See merge request GNOME/gtk!2279
Chun-wei Fan [Fri, 24 Jul 2020 08:25:24 +0000 (16:25 +0800)]
gdk/gdkarrayimpl.c: Fix build on Visual Studio
It seems like initializing something to an empty array using `{}` is a GCCism,
so just stuff a 0 within the braces to accomplish the same thing.
Matthias Clasen [Fri, 24 Jul 2020 02:58:51 +0000 (02:58 +0000)]
Merge branch 'matthiasc/for-master' into 'master'
filechooser: Remove a leftover signal emission
Closes #2942
See merge request GNOME/gtk!2276
Matthias Clasen [Thu, 23 Jul 2020 20:14:33 +0000 (16:14 -0400)]
docs: Work around escaping bugs
This is truly a russian doll of documentation formats:
a string containing <> inside an xml fragment in an |[ ]|
gtk-doc example in markdown in a doc comment.
Sadly, something gets escaping wrong, so the <> end up
literally in the docbook and mess up the last step of
our document formatting, even after turning them into
entities.
Work around this with an extra level of entities that
really shouldn't be necessary.
Matthias Clasen [Thu, 23 Jul 2020 19:46:06 +0000 (15:46 -0400)]
docs: Pass --standalone to pandoc
This flag causes pandoc to emit a proper doctype
declaration and, crucially, namespace declarations
for the xlink namespace that it insists on using
for href attributes. Without this, putting external
links in md documents doesn't survive the journey
through xml.
Matthias Clasen [Thu, 23 Jul 2020 16:57:08 +0000 (12:57 -0400)]
docs: Improve shortcut trigger docs
Point out the need to escape <> in xml.
Matthias Clasen [Thu, 23 Jul 2020 16:43:46 +0000 (12:43 -0400)]
docs: Explain the shortcutcontroller example a bit
Add a reference to the the syntax for shortcut actions
in builder files.
Matthias Clasen [Thu, 23 Jul 2020 11:58:57 +0000 (07:58 -0400)]
filechooser: Remove a leftover signal emission
Commit
0145809a94667c75ed4a4 replace the response-requested
signal with an action, but didn't actually remove the emission
of that no-longer-existing signal.
Fixes: #2942
Benjamin Otte [Thu, 23 Jul 2020 14:34:33 +0000 (14:34 +0000)]
Merge branch 'wip/otte/for-master' into 'master'
Wip/otte/for master
See merge request GNOME/gtk!2277
Benjamin Otte [Thu, 23 Jul 2020 01:35:26 +0000 (03:35 +0200)]
searchenginemodel: Remove unused code
Benjamin Otte [Thu, 23 Jul 2020 01:06:42 +0000 (03:06 +0200)]
searchengine: Remove unused set_recursive() call
Florentina Mușat [Thu, 23 Jul 2020 10:33:16 +0000 (10:33 +0000)]
Update Romanian translation
Florentina Mușat [Thu, 23 Jul 2020 10:32:08 +0000 (10:32 +0000)]
Update Romanian translation
Matthias Clasen [Thu, 23 Jul 2020 00:19:15 +0000 (00:19 +0000)]
Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master
See merge request GNOME/gtk!2275
Matthias Clasen [Wed, 22 Jul 2020 23:51:27 +0000 (19:51 -0400)]
NEWS: Updates
Matthias Clasen [Wed, 22 Jul 2020 23:38:58 +0000 (19:38 -0400)]
migration guide: Add some tables
Add a table mapping event signals to their event controller
replacements, and a table mapping former GtkContainer
subclasses to their gtk_container_add replacement.
Benjamin Otte [Wed, 22 Jul 2020 18:08:24 +0000 (18:08 +0000)]
Merge branch 'wip/otte/for-master' into 'master'
timsort: Actually 0-terminate the array in get_runs()
See merge request GNOME/gtk!2274
Benjamin Otte [Wed, 22 Jul 2020 16:59:22 +0000 (18:59 +0200)]
timsort: Actually 0-terminate the array in get_runs()
This could cause SEGVs when changing the sort during an ongoing sort
operation.
Yuri Chornoivan [Wed, 22 Jul 2020 13:27:26 +0000 (13:27 +0000)]
Update Ukrainian translation
Yuri Chornoivan [Wed, 22 Jul 2020 13:22:09 +0000 (13:22 +0000)]
Update Ukrainian translation
Matthias Clasen [Wed, 22 Jul 2020 13:15:45 +0000 (13:15 +0000)]
Merge branch 'wip/otte/sortlistmodel2' into 'master'
Massively refactor and improve sortlistmodel
See merge request GNOME/gtk!2273
Piotr Drąg [Wed, 22 Jul 2020 13:01:05 +0000 (15:01 +0200)]
Update POTFILES.in
Benjamin Otte [Wed, 22 Jul 2020 01:18:33 +0000 (03:18 +0200)]
gtk-demo: Add a progress bar when the colors demo resorts
Benjamin Otte [Wed, 22 Jul 2020 00:50:58 +0000 (02:50 +0200)]
sortlistmodel: Add progress estimation
Benjamin Otte [Sun, 12 Jul 2020 15:57:03 +0000 (17:57 +0200)]
timsort: Add progress estimation
Benjamin Otte [Tue, 21 Jul 2020 23:43:59 +0000 (01:43 +0200)]
sortlistmodel: Make key generation part of the step function
SSave the missing keys as a bitset and iterate over that bitset in the
step function.
Solves the problem with a large UI block at the beginning of a sort
operation when all the keys were generated, in particular when key
generation was slow.
Benchmarks for maximum time taken by a single main loop callback:
initial sort with complex GFileInfo keys
old new
32,000 items 137ms 3ms
128,000 items 520ms 31ms
initial sort with string keys
old new
32,000 items 187ms 1ms
128,000 items 804ms 3ms
Benjamin Otte [Tue, 21 Jul 2020 23:43:40 +0000 (01:43 +0200)]
gtk-demo: Make colors demo do incremental sorting
Benjamin Otte [Tue, 21 Jul 2020 02:50:05 +0000 (04:50 +0200)]
sortlistmodel: Properly compute runs
When updating a (partially) sorted model, take the known runs for the
existing sort and apply them to the new sort. That way, we don't have to
check the whole model again.
Benchmarks:
appending half the items to a model of strings
old new
512,000 items 437ms 389ms
1,024,000 items 1006ms 914ms
appending 10% of the items to a model of strings
old new
512,000 items 206ms 132ms
1,024,000 items 438ms 301ms
appending 1 item to a model of strings
old new
64,000 items 1.8ms 0.00ms
512,000 items --- 0.01ms
Benjamin Otte [Tue, 21 Jul 2020 02:06:13 +0000 (04:06 +0200)]
sortlistmodel: Make sort stable again
Previously, the sort was not stable when items were added/removed while
sorting or the sort algorithm was changed.
Now the sort looks at the item position (via the key's location in the
keys array) to make sure each comparison stays stable with respect to
this position.
Benjamin Otte [Mon, 20 Jul 2020 20:24:36 +0000 (22:24 +0200)]
multisorter: Implement GtkSortKeys
Benjamin Otte [Sun, 19 Jul 2020 02:58:06 +0000 (04:58 +0200)]
treelistrowsorter: Implement GtkSortKeys
Benjamin Otte [Thu, 16 Jul 2020 12:03:09 +0000 (14:03 +0200)]
numericsorter: Implement GtkSortKeys
Benjamin Otte [Wed, 15 Jul 2020 18:28:45 +0000 (20:28 +0200)]
stringsorter: Implement GtkSortKeys
Benjamin Otte [Thu, 16 Jul 2020 10:05:45 +0000 (12:05 +0200)]
sortkeys: Add an equal sort keys
Compares every element as equal.
This is useful when sorters are in an invalid configuration.
Benjamin Otte [Tue, 21 Jul 2020 01:40:28 +0000 (03:40 +0200)]
sortlistmodel: Use GtkSortKeys
This massively speeds up sorting with expensive sort functions that it's
the most worthwhile optimization of this whole branch.
It's slower for simple sort functions though.
It's also quite a lot slower when the model doesn't support sort keys
(like GtkCustomSorter), but all the other sorters do support keys.
Of course, this depends on the number of items in the model - the number
of comparisons scales O(N * log N) while the overhead for key handling
scales O(N).
So as the log N part grows, generating keys gets more and more
beneficial.
Benchmarks:
initial sort of a GFileInfo model with display-name keys
items keys
8,000 items 715ms 50ms
64,000 items --- 554ms
initial sort of a GFileInfo model with complex keys
items keys
64,000 items 340ms 295ms
128,000 items 641ms 605ms
removing half a GFileInfo model with display-name keys
(no comparisons, just key freeing overhead of a complex sorter)
items keys
512,000 items 14ms 21ms
2,048,000 items 40ms 62ms
removing half a GFileInfo model with complex keys
(no comparisons, just key freeing overhead of a complex sorter)
items keys
512,000 items 90ms 237ms
2,048,000 items 247ms 601ms
Benjamin Otte [Wed, 15 Jul 2020 18:17:55 +0000 (20:17 +0200)]
sorter: Introduce GtkSortKeys
GtkSortKeys is an immutable struct that can be used to manage "sort
keys" for items.
Sort keys are memory that is created specifically for sorting. Because
sorting involves lots of comparisons, it's a good idea to prepare the
data relevant for sorting in advance and sort on that data.
In measurements with a PropertyExpression on a string sorter, it's about
??? faster
Benjamin Otte [Tue, 21 Jul 2020 01:09:10 +0000 (03:09 +0200)]
sortlistmodel: Split the SortItem into 2 arrays
Instead of one item keeping the item + its position and sorting that
list, keep the items in 1 array and put the positions into a 2nd array.
This is generally slower while sorting, but allows multiple improvements:
1. We can replace items with keys
This allows avoiding multiple slow lookups when using complex
comparisons
2. We can keep multiple position arrays
This allows doing a sorting in the background without actually
emitting items-changed() until the array is completely sorted.
3. The main list tracks the items in the original model
So only a single memmove() is necessary there, while the old version
had to upgrade the position in every item.
Benchmarks:
sorting a model of simple strings
old new
256,000 items 256ms 268ms
512,000 items 569ms 638ms
sorting a model of file trees, directories first, by size
old new
64,000 items 350ms 364ms
128,000 items 667ms 691ms
removing half the model
old new
512,000 items 24ms 15ms
1,024,000 items 49ms 25ms
Benjamin Otte [Tue, 21 Jul 2020 00:50:45 +0000 (02:50 +0200)]
sortlistmodel: Add an incremental property
Also refactor a large part of the sortmodel to make this convenient.
A large amount of time has been spent on getting items-changed regions
minimized.
Benjamin Otte [Sun, 12 Jul 2020 04:53:06 +0000 (06:53 +0200)]
testsuite: Add exhaustive sortlistmodel test
This is basically a copy/paste from the filterlistmodel test, but
adapted for sorting.
Benjamin Otte [Mon, 20 Jul 2020 23:40:06 +0000 (01:40 +0200)]
sortlistmodel: Make the sort callback useful
1. Run step() for a while to avoid very short steps
This way, we batch items-changed() emissions.
2. Track the change region accurately
This way, we can avoid invalidating the whole list if our step just
touched a small part of a huge list.
As this is a merge sort, this is a common occurence when we're buys
merging chunks: The rest of the model outside those chunks isn't
changed.
Note that the tracking is accurate: It determines the minimum change
region in the model.
This will be important, because the testsuite is going to test this.
Benjamin Otte [Sun, 12 Jul 2020 02:20:19 +0000 (04:20 +0200)]
timsort: Add change tracking to gtk_tim_sort_step()
Benjamin Otte [Sat, 18 Jul 2020 02:45:46 +0000 (04:45 +0200)]
timsort: Add gtk_tim_sort_set_max_merge_size()
Makes the SOrtListModel responsive when incrementally sorting.
By making it configurable we can avoid losting performance in the
non-incremental case.
Benjamin Otte [Sat, 11 Jul 2020 18:34:16 +0000 (20:34 +0200)]
timsort: Make sure merges don't take too long
Limit the size of the merged areas and thereby chunk larger merges into
smaller ones.
Benjamin Otte [Mon, 20 Jul 2020 23:46:09 +0000 (01:46 +0200)]
sortlistmodel: Make sorting incremental
This is just an experiment so far to see how long it takes to sort.
Benjamin Otte [Sat, 11 Jul 2020 04:02:58 +0000 (06:02 +0200)]
timsort: Add gtk_tim_sort_set_runs()
... and use it in the SortListModel
Setting runs allows declaring already sorted regions so the sort does
not attempt to sort them again.
This massively speeds up partial inserts where we can reuse the sorted
model as a run and only resort the newly inserted parts.
Benchmarks:
appending half the model
qsort timsort
128,000 items 94ms 69ms
256,000 items 202ms 143ms
512,000 items 488ms 328ms
appending 1 item
qsort timsort
8,000 items 1.5ms 0.0ms
16,000 items 3.1ms 0.0ms
...
512,000 items --- 1.8ms
Benjamin Otte [Fri, 17 Jul 2020 00:47:22 +0000 (02:47 +0200)]
sortlistmodel: Use timsort
Simply replace the old qsort() call with a timsort() call.
This is ultimately relevant because timsort is a LOT faster in merging
to already sorted lists (think items-chaged adding some items) or
reversing an existing list (think columnview sort order changes).
Benchmarks:
initially sorting the model
qsort timsort
128,000 items 124ms 111ms
256,000 items 264ms 250ms